<template>
  选择方案：
  <el-select
      style="width: 70%"
      v-model="dataForm.id"
      clearable
      placeholder="选择方案"
  >
    <el-option
        v-for="item in options"
        :key="item.id"
        :label="item.name"
        :value="item.id"
    />
  </el-select>
</template>

<script lang="ts">
import useView from "@/hooks/useView";
import {defineComponent, reactive, toRefs} from "vue";
import baseService from "@/service/baseService";

export default defineComponent({
  // props:{
  //   dialogVisible: {
  //     type: Boolean,
  //     required: false
  //   }
  // },
  setup() {
    const state = reactive({
      dialogVisible: true,
      options: [],
      dataForm: {
        id: "",
        winType: 0,
        cameraList: [] as any
      }
    });
    return {...useView(state), ...toRefs(state)};
  },
  created() {
    this.getSchemeList();
  },
  methods: {
    getSchemeList() {
      baseService.get("/kxPlayScheme/kxplayscheme/getSchemeList").then((stat) => {
        this.options = stat.data;
      });
    },
    enterok() {
      return new Promise((resolve, reject) => {
        baseService.put("/kxPlayScheme/kxplayscheme", this.dataForm).then((res) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
            reject('操作失败');
          } else {
            this.$message.success("收藏成功！");
            this.$emit("close");
            resolve('操作成功');
          }
        });
      })

    }
  }
})
</script>

<style scoped>

</style>
